package Coding.Collection;

import java.util.ArrayList;
import java.util.Iterator;

public class CollectionFor {

    public static void main(String[] args) {


        Collection list = new ArrayList();

        list.add("a");
        list.add("b");
        list.add("c");
        list.add("#");


        Iterator iterator = list.iterator();

        while (iterator.hasNext()){

            String next = (String)iterator.next();
            if( "#".equals(next)){
                //
             iterator.remove();
            }

            System.out.println(next);

        }
        System.out.println(list);



    }
}
